package io.itit.ecp.admin.provide.action.controller.miniprogram;


import io.itit.ecp.admin.provide.action.resp.MiniProgramContentResp;
import io.itit.ecp.admin.server.entity.MiniProgramContentEntity;
import io.itit.ecp.admin.server.service.IMiniProgramContentService;
import io.itit.grass.common.provide.action.resp.ResultResp;
import io.itit.grass.common.server.utils.ConvertUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 小程序内容管理
 */
@Api(tags = {"小程序内容管理"})
@RestController
@RequestMapping("mini/content")
@RequiredArgsConstructor
public class MiniContentController {

    private final IMiniProgramContentService miniProgramContentService;

    /**
     * 内容管理
     */
    @GetMapping("get")
    @ApiOperation(value = "内容管理-查询信息")
    public ResultResp<MiniProgramContentResp> get(@RequestParam String id) {
        MiniProgramContentEntity miniProgram = miniProgramContentService.getById(id);
        return ResultResp.success(ConvertUtils.convert(miniProgram, MiniProgramContentResp.class));
    }
}
